/**
 * outsider.com.cn Inc.
 * Copyright (c) 2011-2022 All Rights Reserved.
 */
package com.yuanmeng.common.core.enums;

import com.yuanmeng.common.core.exception.ServiceException;
import lombok.Getter;

/**
 * @author outsider
 * @version Id: StatusEnum.java, v 0.1 2022/6/1 17:16 outsider Exp $$
 */
@Getter
public enum OrderSourceEnum {
    MALL("MALL", "商城订单"),

    COMMUNITY("COMMUNITY", "社区订单"),

    RECHARGE("RECHARGE", "充值业务"),

    FOOD_EQUIPMENT("FOOD_EQUIPMENT", "点餐设备");

    private String code;

    private String message;

    OrderSourceEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static void validateOrderSourceEnum(String payMethod) {
        String method = null;
        for (OrderSourceEnum enums : OrderSourceEnum.values()) {
            if (enums.code.equals(payMethod)) {
                method = enums.getCode();
            }
        }
        if(null == method) {
            throw new ServiceException("订单来源枚举值不存在，请确认后重试");
        }
    }
}